package com.api.hg.web;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.api.hg.action.assetDiscovery;
import com.api.hg.action.discoveryList;
import com.engine.common.util.ParamUtil;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import java.util.HashMap;
import java.util.Map;

@Path("/hgasslist")
public class DiscoveryListApi {
    @POST
    @Path("/discoverylist")
    @Produces({"text/plain"})
    //public String UpdModelRole(JSONObject json){
    public String NewXiaoz(@Context HttpServletRequest var1, @Context HttpServletResponse var2){
        Map<String, Object> apidatas = new HashMap<String, Object>();
        JSONArray zcinfo=new JSONArray();
        String errormess="";//
        try{
            User user = HrmUserVarify.getUser(var1, var2);
            discoveryList assetDiscovery=new discoveryList();
            apidatas=assetDiscovery.getTableDiscovery(ParamUtil.request2Map(var1),user);
        }catch(Exception e){

        }

        return JSONObject.toJSONString(apidatas);
    }
    @POST
    @Path("/checkassadmin")
    @Produces({"text/plain"})
    //public String UpdModelRole(JSONObject json){
    public String CheckAssAdmin(@Context HttpServletRequest var1, @Context HttpServletResponse var2){
        Map<String, Object> apidatas = new HashMap<String, Object>();
        JSONArray zcinfo=new JSONArray();
        String errormess="";//
        try{
            User user = HrmUserVarify.getUser(var1, var2);
            discoveryList assetDiscovery=new discoveryList();
            apidatas=assetDiscovery.CheckAssAdmin(ParamUtil.request2Map(var1),user);
        }catch(Exception e){

        }
        return JSONObject.toJSONString(apidatas);
    }

@POST
@Path("/discoveryswtable")
@Produces({"text/plain"})

public String getTableDataSW(@Context HttpServletRequest var1, @Context HttpServletResponse var2){
    Map<String, Object> apidatas = new HashMap<String, Object>();
    JSONArray zcinfo=new JSONArray();
    String errormess="";//
    try{
        User user = HrmUserVarify.getUser(var1, var2);
        discoveryList assetDiscovery=new discoveryList();
        apidatas=assetDiscovery.getTableDataSW(ParamUtil.request2Map(var1),user);
    }catch(Exception e){

    }
    return JSONObject.toJSONString(apidatas);
}

    @POST
    @Path("/singlediscoveryswtable")
    @Produces({"text/plain"})

    public String getSinglediscoveryswtable(@Context HttpServletRequest var1, @Context HttpServletResponse var2){
        Map<String, Object> apidatas = new HashMap<String, Object>();
        JSONArray zcinfo=new JSONArray();
        String errormess="";//
        try{
            User user = HrmUserVarify.getUser(var1, var2);
            discoveryList assetDiscovery=new discoveryList();
            apidatas=assetDiscovery.getSinglediscoveryswtable(ParamUtil.request2Map(var1),user);
        }catch(Exception e){

        }
        return JSONObject.toJSONString(apidatas);
    }
}
